<?php
class Router extends Object{
	
	public static $COMPONENTS = "components";
	
	function __construct() {
	}
	
	function loadComponent(){
		if(Request::getVar("com")==false) return false;
		$com=Request::getVar("com");
		$this->set("comPath",site_path . self::$COMPONENTS.DIRSEP.$com);
		
		$fileCon=new File($this->get("comPath").DIRSEP."Controller.php");
		$fileView=new File($this->get("comPath").DIRSEP."View.php");
		$fileModel=new File($this->get("comPath").DIRSEP."Model.php");
		if($fileCon->fileReadable()&&$fileView->fileReadable()&&$fileModel->fileReadable()){
			require_once($fileCon->file);
			require_once($fileModel->file);
			require_once($fileView->file);
			$con=new Controller();
			$con->setUp($this->get("comPath"));
			return $con;
		}
		return false;
	}
}
?>